﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace safehomeSimulation
{
    public class Sensors
    {
        protected utility.SensorType _sensor;
        protected Msg _msg  = new Msg() ;
        protected string ID;

       public Msg GetMsg()
        {
            return _msg;
        }


    }

    public class TemperatureSensor : Sensors
    {
        private float _tempeartureCriticalPoint = 0.0f;

        public TemperatureSensor()
        {
            _sensor = utility.SensorType.TemperatureSensor;
        }

        public TemperatureSensor(string SId)
        {
            _sensor = utility.SensorType.TemperatureSensor;
            ID = SId;
        }

        public void SetCriticalPoint(float set)
        {
            _tempeartureCriticalPoint = set;
        }

        public void CaptureEnvironment(float cap)
        {
            if (cap > _tempeartureCriticalPoint)
                _msg.MId = utility.ExceptionType.TypeTemperature;
            else
                _msg.MId = utility.ExceptionType.TypeNormal;
            _msg.location = ID;

        }

    }

    public class WetSensor : Sensors
    {
        private float _wetCriticalPoint = 0.0f;

        public WetSensor()
        {
            _sensor = utility.SensorType.WetSensor;
        }

        public WetSensor(string SId)
        {
            _sensor = utility.SensorType.WetSensor;
            ID = SId;
        }

        public void SetCriticalPoint(float set)
        {
            _wetCriticalPoint = set;
        }

        public void CaptureEnvironment(float cap)
        {
            if (cap > _wetCriticalPoint)
                _msg.MId = utility.ExceptionType.TypeWet;
            else
                _msg.MId = utility.ExceptionType.TypeNormal;
            _msg.location = ID;

        }
    }

    public class COSensor : Sensors
    {
        private float _COCriticalPoint = 0.0f;

        public COSensor()
        {
            _sensor = utility.SensorType.COSensor;
        }

        public COSensor(string SId)
        {
            _sensor = utility.SensorType.COSensor;
            ID = SId;
        }

        public void SetCriticalPoint(float set)
        {
            _COCriticalPoint = set;
        }

        public void CaptureEnvironment(float cap)
        {
            if (cap > _COCriticalPoint)
                _msg.MId = utility.ExceptionType.TypeCO;
            else
                _msg.MId = utility.ExceptionType.TypeNormal;
            _msg.location = ID;

        }
    }

    public class SmokeSensor : Sensors
    {
        private float _smokeCriticalPoint = 0.0f;

        public SmokeSensor()
        {
            _sensor = utility.SensorType.SmokeSensor;
        }

        public SmokeSensor(string SId)
        {
            _sensor = utility.SensorType.SmokeSensor;
            ID = SId;
        }

        public void SetCriticalPoint(float set)
        {
            _smokeCriticalPoint = set;
        }

        public void CaptureEnvironment(float cap)
        {
            if (cap > _smokeCriticalPoint)
                _msg.MId = utility.ExceptionType.TypeSmoke;
            else
                _msg.MId = utility.ExceptionType.TypeNormal;
            _msg.location = ID;

        }
    }


}
